package crawlers;

import org.jsoup.Connection;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;

public class WebpagetestResult {
	
	private Document doc = null;
	
	private String url = "http://www.webpagetest.org/result/";
	
	public WebpagetestResult(String id) {
		try {
			//Goto homepage
			String urlResult = url + id;
			doc = Jsoup.connect(urlResult).get();
		} catch (Exception e) {
			// TODO: handle exception
		}
	}
	
	
	public String getTableResult() {
		String tableResults = doc.select("#average").html();
		
		return tableResults;
	}
	
	public String get1WaterfallThumb(String id) {
		String img = url + id + "/1_waterfall_thumb.png";
		
		return img;
	}
	
	public String get1ScreenThumb(String id) {
		String img = url + id + "/1_screen_thumb.jpg";
		
		return img;
	}
	
	public String get1CachedWaterfallThumb(String id) {
		String img = url + id + "/1_Cached_waterfall_thumb.png";
		
		return img;
	}
	
	public String get1CachedScreenThumb(String id) {
		String img = "http://www.webpagetest.org/result/"+id+"/1_Cached_screen_thumb.jpg";
		
		return img;
	}	
}
